﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Authority.Services;

using DoNet.FrameWork.Services.Impl;
using DoNet.FrameWork.Repository;
using DoNet.FrameWork.Repository.Specification;
using Authority.Entity;
using Authority.Repositories;

namespace Authority.Services.Impl
{
    public class ModulesServiceImpl : ServicesBase<Modules>,IModulesService
    {
        IControlsRepository controlsRepository;

        public ModulesServiceImpl(IUnitOfWork _context, IModulesRepository _Repository, IControlsRepository _controlsRepository)
            : base(_context, _Repository)
        {
            this.controlsRepository = _controlsRepository;
        }

        public List<Modules> GetALLModules()
        {
            ISpecification<Modules> condition = new DirectSpecification<Modules>(m => m.IsDeleted == false);
            Expression<Func<Modules,string>> orderByExpression = m => m.Code;
            return repository.GetList<string>(condition,orderByExpression,false);
        }

        public string GetALLControls()
        {
            return "Controlsx" ;
        }
    }
}
